package com.stockz.train.view.widget;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.stockz.train.manager.TrainingManager;
import com.stockz.ui.swing.widget.JMenuItem;

@Component
public class StartMenuItem extends JMenuItem implements InitializingBean, ActionListener{
	private static final long serialVersionUID = 8512125467022964805L;

	@Autowired
	private TrainingMenu trainingMenu;
	@Autowired
	private TrainingManager trainingManager;
	
	public StartMenuItem() {
		super("Start",KeyEvent.VK_S,ActionEvent.ALT_MASK,"chart.png");
		addActionListener(this);
	}
	
	@Override
	public void afterPropertiesSet() throws Exception {
		trainingMenu.add(this);
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		
		
		trainingManager.start(null, 0);
	}
	
}
